package com.jinrustar.shenjiying.core.support

import android.app.Fragment
import android.content.Context
import butterknife.ButterKnife

import android.os.Bundle
import android.support.annotation.Nullable
import android.view.ViewGroup
import android.view.LayoutInflater
import android.view.View


/**
 * Created by wei on 17-12-14.
 */
abstract class BaseFragment : Fragment() {
    protected var TAG = this.javaClass.simpleName

    abstract fun getContentViewId(): Int
    protected lateinit var actContext: Context
    protected lateinit var mRootView: View

    @Nullable
    override fun onCreateView(inflater: LayoutInflater, @Nullable container: ViewGroup?, @Nullable savedInstanceState: Bundle): View? {
        mRootView = inflater.inflate(getContentViewId(), container, false)
        ButterKnife.bind(this, mRootView)//绑定framgent
        this.actContext = activity
        initAllMembersView(savedInstanceState)
        return mRootView
    }

    protected abstract fun initAllMembersView(savedInstanceState: Bundle)

    override fun onDestroyView() {
        super.onDestroyView()
        /*ButterKnife.unbind(this)//解绑*/
    }
}